<?php

/**
 * MVM_MALL 网上商店系统 文章提交文件
 * ============================================================================
 * 版权所有 (C) 2007-2010 www.mvmmall.com，并保留所有权利。
 * 网站地址: http://www.mvmmall.com
 * ----------------------------------------------------------------------------
 * 这是一个免费开源的软件；这意味着您可以在不用于商业目的的前提下对程序代码
 * 进行修改、使用和再发布。
 * ============================================================================
 * $Author:  www.mvmmall.com  $
 * $Date: 2008-06-30 $
 * $Id: post.php  www.mvmmall.com$
 * ---------------------------------------------
*/
require_once './include/common.inc.php';
require_once MVMMALL_ROOT .'header.php';
include_once MVMMALL_ROOT.'./include/board_comm.inc.php';
if($ps_mode=='write'){
	if($m_check_rank < $mm_board['class_write']) {
		!$m_check_id ? show_msg('board_grant_write',GetBaseUrl('logging','login')) : show_msg('admin_acess');
	}
	$title_board = $lang['wite_announce'];
}elseif ($ps_mode=='modify'){
	if($m_check_rank < $mm_board['class_modify']) {
		!$m_check_id && show_msg('board_grant_modify',GetBaseUrl('logging','login'));
	}
	$title_board = $lang['edit_announce'];
} elseif ($ps_mode=='reply'){
	if($m_check_rank < $mm_board['class_reply']) {
		!$m_check_id ? show_msg('board_grant_modify',GetBaseUrl('logging','login')) :show_msg('board_grant_reply');
	}
	$title_board=$lang['uesr_reply'];
	$article['board_subject'] = '';
	$article['board_body']    = '';
	
}elseif ($ps_mode=='editreply' && is_numeric($uid)){
	if($m_check_rank < $mm_board['class_reply']) {
		!$m_check_id ? show_msg('board_grant_modify',GetBaseUrl('logging','login')) :show_msg('board_grant_reply');
	}
	$reply_list  = $db->get_one("SELECT user_name,reply_subject,reply_body,uid FROM `{$tablepre}bcomment` WHERE uid='$uid'");
	$title_board = $lang['edit_announce'];
	$article['board_name']    = $reply_list['user_name'];
	$article['board_subject'] = $reply_list['reply_subject'];
	$article['board_body']    = $reply_list['reply_body'];
	$id = $uid;
}
else {
	show_msg('pass_worng');
}

if ($ps_mode=='write' || $ps_mode=='modify') {
	// HTML 使用有无检查
	if($mm_board['use_html'] == '1' && $m_check_rank >= $mm_board['grant_html']) {
		$grant_html = "<input type=\"checkbox\" name=\"use_html\" value=\"1\" checked> $lang[html]";
	}

	// 悄悄话检查
	if($mm_board['use_secret'] == '1' && $m_check_rank >= $mm_board['grant_secret']) {
		$checked     = $article['use_secret'] ==1 && $article ? 'checked':'';
		$uesr_secret =  "<input type=\"checkbox\" name=\"use_secret\" value=\"1\" $checked> $lang[uesr_secret]";
	}

	// 邮件无检查
	if($mm_board['use_white_remail'] == '1') {
		$user_mail   = "<input type=\"checkbox\" name=\"use_mail\" value=\"1\" checked> $lang[user_mail] ";
	}

	//  公告事项
	if($m_check_rank >= $mm_board['class_notice']) {
		$checked = $article['headnum'] < 1000 && isset($article['headnum']) ? 'checked':'';
		$notice  ="<input type=\"checkbox\" name=\"use_notice\" value=\"1\" $checked> $lang[uesr_top] ";
	}
}
//对HTML标签进行一下处理by dxd
$article['board_body']=str_replace('&lt;br /&gt;',chr(13).chr(10),$article['board_body']);
//end 处理


//引入在线编辑器
if($mm_board['use_html'] == '1' && $m_check_rank >=$mm_board['class_html']){
	require_once MVMMALL_ROOT.'./include/fck/fckeditor.php';
	$oFCKeditor = new FCKeditor('FCKeditor1');
	$oFCKeditor->BasePath = 'include/fck/' ;
	$oFCKeditor->InstanceName = 'board_body' ;
	$oFCKeditor->ToolbarSet = 'Normal' ;
	$oFCKeditor->Width = '100%' ;
	$oFCKeditor->Height = '300' ;
	$oFCKeditor->Value = $article['board_body'];
	$_SESSION['mvm_user_fck']='1';
}
$navigation = make_navigation($mm_board['board_title'],GetBaseUrl('board',$action));//导航
include template('board_modify');
footer();